package com.kobe.demo.repository;

import com.kobe.demo.entity.ModuleEntity;
import com.kobe.demo.entity.RoleEntity;
import com.kobe.demo.repository.temp.RoleEx;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
 * 创建 JYQ  on  2018/10/31,17:48
 */
public interface RoleInfoRepository extends JpaRepository<RoleEntity,Long> {

    @Query(value = "select  role from RoleEntity  role")
    List<RoleEntity> roles();
    @Query(value = "select role.role_id as roleId, role.role_name as roleName, count(rm.temp_module_id) " +
            "as moduleCount from  role_info role " +
            "left join role_module rm on" +
            " role.role_id=rm.temp_role_id group by role.role_id",nativeQuery = true)
    List<RoleEx>  roleGroup();

    List<?> queryList();
}
